/*
 * 作者：泡了砒霜的蒜
 * 时间：2020-06-21
 */

#include <BleMouse.h>

BleMouse bleMouse("mang","xiaomi",100);

int ttt;
int temp;

void setup() {
  Serial.begin(115200);
  Serial.println("Starting BLE work!");
  bleMouse.begin();
  
}
 
void loop() {
  if(bleMouse.isConnected()) {
    
    unsigned long startTime;
    
    temp = random(50,120);      
    ttt =  temp * 100;                           //随机时间3~10S，可按照自己想法修改
      
    Serial.println("鼠标右移");
    startTime = millis();
    while(millis()<startTime+180) {
      bleMouse.move(60,0);
      delay(18);
   }

    Serial.println("点击左键");
    bleMouse.click(MOUSE_LEFT);   //点击左键

    delay(ttt);
    
   }
  }
